Php_sample_descriptor_dtor (//) is a callback function for resource reclamation, defined at the initialization of the resource.
zend_rsrc_list_entry *rsrc tsrmls_dc)
{
Php_sample_descriptor_data *fdata =
(php_sample_descriptor_data*) rsrc->ptr;
Fclose (FDATA->FP);
Efree (fdata->filename);
Efree (
recycling, which is defined at the Resource Initialization. Zend_rsrc_list_entry * rsrc TSRMLS_DC) {php_sample_descriptor_data * fdata = (optional *) rsrc-> ptr; fclose (fdata-> fp); efree (fdata-> filename ); efree (fdata );}This static function is used to recycle resources. You need to specify a callback when Initia
;} php_sample_descriptor_data;Using this structure, you can store file names and file handle resources to share different requests.
Corresponding changes must be made in the source file:
Static void php_sample_descriptor_dtor (// This is the callback function for resource recycling, which is defined at the resource initialization. Zend_rsrc_list_entry * rsrc TSRMLS_DC) {php_sample_descriptor_data * fdata = (optional *) rsrc-> ptr; fclose (
to the header file:
typedef struct _php_sample_descriptor_data { char *filename; FILE *fp;} php_sample_descriptor_data;Using this structure, you can store file names and file handle resources to share different requests.
Corresponding changes must be made in the source file:
Static void php_sample_descriptor_dtor (// This is the callback function for resource recycling, which is defined at the resource initialization. Zend_rsrc_list_entry * rsrc TSRMLS_DC) {php_sample_descriptor_data *
. However, persistent resources must exist between requests. For a file handle class resource, if you want to add a storage file name, you must add the following code to the header file:
typedef struct _php_sample_descriptor_data { char *filename; FILE *fp;} php_sample_descriptor_data;Using this structure, you can store file names and file handle resources to share different requests.
Corresponding changes must be made in the source file:
Static void php_sample_descriptor_dtor (// This
(//This is a callback function for resource recycling, defined at the initialization of the resource. zend_rsrc_list_entry *rsrc tsrmls_dc) { Php_sample_descriptor_data *fdata = (php_sample_descriptor_data*) rsrc->ptr; Fclose (FDATA->FP); Efree (fdata->filename); Efree (fdata
Php_sample_descriptor_dtor (//This is a callback function for resource recycling, defined at the initialization of the resource. zend_rsrc_list_entry *rsrc tsrmls_dc) { Php_sample_descriptor_data *fdata = (php_sample_descriptor_data*) rsrc->ptr; Fclose (FDATA->FP); Efree (fdata->filename); Efree (
JS Judging the words of Chinese characters//**************************************************************** //* Name: Datalength//* Function: Calculate the length of the data//* Entry Parameters: FData: Data to be calculated//* Exit Parameters: Returns the length of the Fdata (Unicode length is 2, non-Unicode length is 1)//***************************************************************** functiondatalength
I picked a post titled common JavaScript functions from the Internet two days ago, which contains verification functions that are commonly used on the client, however, all the functions in it use the string Decomposition Method for judgment,ArticleAfter submission, many friends suggested that many functions can be replaced by regular expressions. I will change these functions to regular expressions for verification tonight. Please give me some advice if they are good or not.
//
Use this e
This article describes how to use JavaScript to determine the length, number, Email, phone number, and other commonly used judgment functions. This article provides the implementation code directly. For more information, see
/*************************************** * *********************** // * Name: dataLength // * function: Calculate the Data Length // * entry parameter: fData: The data to be calculated // * exit parameter: returns the length of
//
Use this expression to obtain the string length.
Function
Regdatalength (fdata)
{ VaR Vallength = Fdata. length; VaR Reg = New Regexp ( " ^ [\ U0391-\ uffe5] $ " ); VaR Result = 0 ; For (I = 0 ; I Vallength; I ++ ) { If (Reg. Test (fdata. charat (I ))) {Result+ =2;} Else {Result++;} } Return Result
Javascript Form Verification Regular Expressions
Use a regular expression to determine whether it is a 0-9 Arabic number
CopyCode The Code is as follows: function regisdigit (fdata)
{
VaR Reg = new Regexp ("^ [0-9] $ ");
Return (Reg. Test (fdata ));
}
Use this expression to obtain the string length.Copy codeThe Code is as follows: function regdatalength (fdata)
Examples of regular expressions used in script, but without saying how these regular expressions are used, now give you a few examples that you can look at.Use regular expressions to determine if the Arabic numerals are 0-9
function Regisdigit (fData)
{
var reg = new RegExp ("^[0-9]$");
Return (Reg.test (fData));
}
Use this expression to get the length of the string
function
Examples of regular expressions used in script, but without saying how these regular expressions are used, now give you a few examples that you can look at.Use regular expressions to determine if the Arabic numerals are 0-9
function Regisdigit (fData)
{
var reg = new RegExp ("^[0-9]$");
Return (Reg.test (fData));
}
Use this expression to get the length of the string
function
JavaScript Form Validation Regular expression encyclopedia
Using regular expressions to determine whether the Arabic numerals are 0-9
Copy Code code as follows:
function Regisdigit (fdata)
{
var reg = new RegExp ("^[0-9]$");
Return (Reg.test (fdata));
}
Use this expression to get the length of the string
Copy Code code as follows:
function Regdatalength (
Using regular expressions to determine whether the Arabic numerals are 0-9
Copy Code code as follows:
function Regisdigit (fdata)
{
var reg = new RegExp ("^[0-9]$");
Return (Reg.test (fdata));
}
Use this expression to get the length of the string
Copy Code code as follows:
function Regdatalength (fdata)
{
var va
* Data [TID]. Y +Data [TID]. z * data [TID]. Z;}
It is not coalesced reading because the vec3d size is 12 bytes instead of 4 bytes, 8 bytes, or 16 bytes. To solve this problem, use the _ align (n) _ Directive, for example:
Struct _ align _ (16) vec3d {float x, y, z ;};
This causes compiler to add an empty 4 bytes behind vec3d to complete 16 bytes. Another method is to convert the data structure into three consecutive arrays, for example:
_ Global _ void func (float * X, float * y, float
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.